﻿package com.zretc.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {

	// ↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2016102800772731";

	// 商户私钥，您的PKCS8格式RSA2私钥
	public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCboD8fbwOcW+q3HLhB0Q810cgXAXoaIOpQnRnx/YmGe3w88nLYDipRAQ4W5/3+9UNrwWYjsAa6rmp2odHRphJ5NAvKN5ugRtXUFJLuQUNvusKGGTgO5LGHfrCSfUJRpOKSP5H318FJxHtVS85QPJaPHo/NGC5cykuUk6lsFOYmySxZZqSG7uBOD2JckJCaPz6St1IEPYd6ypsT2XkM3QOGmalcm4BaamDDnu86+fwKyiMqxkMOkhxSfzoXNClyADOxa/u8RazCBPm7O21peV0HaEo2n1Kr3kJay3k1PQAicpFHUNRJ7VfQ48bHQgHYVi9U5TVQkBIfI3Xb/P+Nf5SrAgMBAAECggEAQ8PGWLClWNtpW+ykivw2bE/5mZLqESCOByYxWv70eFui4IMN4OhiIr2b3fuMzQ0NG4muKRIIDBfQgfG6hFiVKLOyAo6uNF9D0sJWrGo8rBUdiPjIQSvx5bcTueXTD+wFQHtv2wTWxIFK1vxYTPXk9VLwePTzkzH/MSYPGuIKyY4Tzyd0eNU2iEf3fUIETIglapnC/QQkWl617C9kuMTSk3il+8dECHte170KiV2qqMHVSnVRtSRlRlk6XrMCuI1nIWr4sGQbYlUIN1k6hunouzjgunHQzrffJ1fL+3gVvAP/Pd5AGrPsoEM17OfpMDeb6Rn3Ay/oxHVXzo+Qq2dHgQKBgQD4ERW2Ski687ANSPIUfj0ziwLCK5p1X55MwSWCu1/MDC6FauLNHZqRotabM2S5aBxFI9MK4n4Qv0DMczdAn8/0WNRgZ7XpgVRbZwXOsZvdUcyd2hNXbUjGOnKuFS/N/Tegzb0XUbxJ0pAGeiG5Vn2AOB/5hosnFtqbtUxYjL2uawKBgQCgmloQ9dhhEThNad5uxhvFlt5uruK7tnB0XoPDSngVEo+6b0ie265hhY/IYudxEIgCklVCic3s9cigSlkidBVkRYKosY4Iig71pbtwTU5YiqsYNKhfLKwOe7Jx30ppLjHJbRpvY+5IL3iAvfZhNjA87PBvmmltbcLqY6AbrXbCwQKBgQCP5lFDAop4MJ5ixnrvWl+kQ7Jg8qxSBBqvCaf50zn6AuMFsABK3i5o5x44v7JhPzyO+v4UpVhd3KP5NajKiyo140WneuHyx3wo3XVn9m2lECtzMirgH1wE6ajWxSGLC6W2WUKkgVyJMmUr7LMdcUeyFlyuAdc84KwFgUD9aP8rawKBgAMIBs0tJsFmRs7HQciLeri3CUnDiUoLvoGjyw7jl/Kl4Aqf0RoWgWsbz0P0AfRTYI3T30IbQcTIOtozrQ0GbeTvnvC6MTkeCfw+/ZO4EdOAAoy5abgqKrE3Sn31vfzQP2ZS5d3WYAgCxV6At2bMVArCWiNxIa5MFRLBgKMlGgnBAoGARfWffMbWtWqJZwQugYIeWTxjuFwIGO5s/BBR4qiwRdmDpJi7yZzznpwgsjJrKDNVyqakoWW+dlg7RaF0tUn+LIgoEPoUxDTiwa0tuHdeK6v5pLiHqGaLOL7hiA4PZpy/JusGLPJgnYDs2XcGALDD1kjmGm3YilQP1r5+WpDJTWw=";

	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
	public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApRZwuRP7XCDuEyW7yovEVTRQHjKEwa7yuf2j6VrdnMS982CBG+Sw9866e59C+iinB97ZvJBgBPR0VoTPWc3CAm+PPhrleVMWly9d1nqi6cWcddxZhGmUFdQY53oXqI+cM8OQX4vpN8jTxPhrIb88AYAqLlCW6dwp7UwkmXw6Tio8IUCxdiIcSlwT9nWLmk/WnRiB3cqQQkFQBYsn1s8lMr/QNa4hE1dZ3K9BYrT+2P7wHaGWDuVMHY95dEIV4OdFdnG0FHrof/f2eOG4rqAdjxvMmOfW+RUc/pTMaCnjs2MBS1kIDsH0shicZZRoeotfw9JBLBe530Me1/6OxdIXNQIDAQAB";

	// 服务器异步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://127.0.0.1:8080/HomeStay/front/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://127.0.0.1:8080/HomeStay/front/return_url.jsp";

	// 签名方式
	public static String sign_type = "RSA2";

	// 字符编码格式
	public static String charset = "utf-8";

	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

	// 支付宝网关
	public static String log_path = "C:\\";

	// ↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

	/**
	 * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
	 * 
	 * @param sWord
	 *            要写入日志里的文本内容
	 */
	public static void logResult(String sWord) {
		FileWriter writer = null;
		try {
			writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis() + ".txt");
			writer.write(sWord);
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			if (writer != null) {
				try {
					writer.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}
	}
}
